#include <stdio.h>  
  
int main(void)  
{  
    char c;  
    int n=0;  
    do  
    {  
        scanf("%c",&c);  
        if((c=='A') || (c=='a'))  
            n++;  
    }  
    while (c!='#');  
    printf("%d\n",n);  
    return 0;  
}
